package tuiLayer;

import java.util.Scanner;
import controllerLayer.*;
import modelLayer.*;

/**
 * Write a description of class MainMenuUI here.
 * 
 * @author Group5
 * @version Alpha
 */
public class MainMenuUI{
	private static Scanner scanner = new Scanner(System.in);
	private static PersonCTR personCtr = new PersonCTR();
	private static DvdCTR dvdCTR = new DvdCTR();
	private static LoanCTR loanCTR = new LoanCTR();
	
	public static void run(){
		boolean quit = false;
		while(!quit){
			printOptions();
			int input = prompt("Make your choice!");
			switch(input) {
				case 1:
					PersonUI.menu(personCtr);
					break;
				case 2:
					DvdUI.menu(dvdCTR);
					break;
				case 3:
					LoanUI.menu(personCtr, dvdCTR, loanCTR);
					break;
				case 4:
					quit = true;
					break;	
				default:
					System.out.println("Sorry, but that's not a choice!");
					printOptions();
			}
		}
	}
	
	private static void printOptions(){
		System.out.println("***MainMenu***");
		System.out.println("1. Friends");
		System.out.println("2. DVDs");
		System.out.println("3. Loans");
		System.out.println("4. Close");
	}
	
	private static int prompt(String prompt){
		System.out.print(" " + prompt + " ");
		int input = scanner.nextInt();
		return input;
	}
}
